<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Constructs an APCUIterator iterator object</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="class.apcuiterator.html">« APCUIterator</a></li>
      <li style="float: right;"><a href="apcuiterator.current.html">APCUIterator::current »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.apcuiterator.html">APCUIterator</a></li>
    <li>Constructs an APCUIterator iterator object</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="apcuiterator.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">APCUIterator::__construct</h1>
  <p class="verinfo">(PECL apcu &gt;= 5.0.0)</p><p class="refpurpose"><span class="refname">APCUIterator::__construct</span> &mdash; <span class="dc-title">Constructs an APCUIterator iterator object</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-apcuiterator.construct-description">
  <h3 class="title">说明</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>APCUIterator::__construct</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type">array</span>|<span class="type">string</span>|<span class="type">null</span></span> <code class="parameter">$search</code><span class="initializer"> = <strong><code>null</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$format</code><span class="initializer"> = APC_ITER_ALL</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$chunk_size</code><span class="initializer"> = 100</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$list</code><span class="initializer"> = APC_LIST_ACTIVE</span></span><br>)</div>

  <p class="para rdfs-comment">
   Constructs an <span class="classname"><a href="class.apcuiterator.html" class="classname">APCUIterator</a></span> <span class="type">object</span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-apcuiterator.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">search</code></dt>

    <dd>

     <p class="para">
      Either a <a href="book.pcre.html" class="link">PCRE</a> regular expression that
      matches against APCu key names, given as a <span class="type">string</span>.
      Or an <span class="type">array</span> of <span class="type">string</span>s with APCu key names.
      Or, optionally <strong><code>null</code></strong> to skip the search.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">format</code></dt>

    <dd>

     <p class="para">
      The desired format, as configured with one or more of the
      <a href="apcu.constants.html" class="link">APC_ITER_*</a> constants.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">chunk_size</code></dt>

    <dd>

     <p class="para">
      The chunk size. Must be a value greater than 0. The default
      value is 100.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">list</code></dt>

    <dd>

     <p class="para">
      The type to list. Either pass in <strong><code>APC_LIST_ACTIVE</code></strong>
      or <strong><code>APC_LIST_DELETED</code></strong>.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 examples" id="refsect1-apcuiterator.construct-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-511">
    <p><strong>示例 #1 A <span class="function"><strong>APCUIterator::__construct()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">foreach&nbsp;(new&nbsp;</span><span style="color: #0000BB">APCUIterator</span><span style="color: #007700">(</span><span style="color: #DD0000">'/^counter\./'</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #0000BB">$counter</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$counter</span><span style="color: #007700">[</span><span style="color: #0000BB">key</span><span style="color: #007700">]</span><span style="color: #DD0000">:&nbsp;</span><span style="color: #0000BB">$counter</span><span style="color: #007700">[</span><span style="color: #0000BB">value</span><span style="color: #007700">]</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">apc_dec</span><span style="color: #007700">(</span><span style="color: #0000BB">$counter</span><span style="color: #007700">[</span><span style="color: #DD0000">'key'</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">$counter</span><span style="color: #007700">[</span><span style="color: #DD0000">'value'</span><span style="color: #007700">]);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-apcuiterator.construct-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.apcu-exists.html" class="function" rel="rdfs-seeAlso">apcu_exists()</a> - Checks if entry exists</span></li>
   <li class="member"><span class="function"><a href="function.apcu-cache-info.html" class="function" rel="rdfs-seeAlso">apcu_cache_info()</a> - 从 APCu 存储中获取缓存信息</span></li>
  </ul>
 </div>


</div></div></div></body></html>